/**
 * @version 1.0
 * @program: 集合demo
 * @description:
 * @author: Kishan Liu
 * @create: 2022-01-19 15:37
 **/
public class Product {
    private  String name;
    private  String quality;
    private  String date;
    private  String producer;
    private  int price;
    private  String warrantyPeriod;
    //初始化商品信息
    public Product(String product){
        switch (product) {
            case "Cola" -> {
                this.name = "可乐";
                this.quality = "500ml";
                this.date = "2022.1.19";
                this.producer = "The Coca-Cola Company";
                this.price = 3;
                this.warrantyPeriod = "12个月";
            }
            case "Sprite" -> {
                this.name = "雪碧";
                this.quality = "500ml";
                this.date = "2022.1.19";
                this.producer = "The Coca-Cola Company";
                this.price = 3;
                this.warrantyPeriod = "12个月";
            }
            case "juice" -> {
                this.name = "果粒橙";
                this.quality = "450ml";
                this.date = "2022.1.19";
                this.producer = "The Coca-Cola Company";
                this.price = 4;
                this.warrantyPeriod = "12个月";
            }
            case "iceBlackTea" -> {
                this.name = "冰红茶";
                this.quality = "500ml";
                this.date = "2022.1.19";
                this.producer = "康师傅";
                this.price = 3;
                this.warrantyPeriod = "12个月";
            }
            case "slicedBread" -> {
                this.name = "切片面包";
                this.date = "2022.1.19";
                this.producer = "Holiland";
                this.price = 30;
                this.warrantyPeriod = "5天";
            }
            case "panpanRolls" -> {
                this.name = "法式盼盼小面包";
                this.quality = "1500g";
                this.date = "2022.1.19";
                this.producer = "盼盼";
                this.price = 31;
                this.warrantyPeriod = "6个月";
            }
        }
    }


    //重写tostring方法
    @Override
    public String toString() {
        return "商品名称:" + name+
                ", 质量（体积）:" + quality +
                ", 生产日期:" + date  +
                ", 生产公司:" + producer  +
                ", 价格:" + price +
                "元, 保质期:" + warrantyPeriod;
    }
}
